/* 项目流程 */
<template lang="html">
  <card :bordered="false">
    <p slot="title" v-if='titleShow'>
      <Row style="padding-bottom: 10px" :gutter="32">
        <Col span="2">
        <h4>项目流程单</h4>
        </Col>
        <Col span="2" style="color:#999;cursor:pointer" @click.native="$emit('back-up')"> 返回>> </Col>
      </Row>
    </p>
    <p v-if="loading">正在加载中</p>
    <table v-else width="100%" cellpadding="0" cellspacing="0" border="1">
      <tr>
        <th colspan="4">项目流程单</th>
      </tr>
      <tr>
        <th>流程</th>
        <th>操作</th>
        <th width="35%">操作记录</th>
        <th>功能</th>
      </tr>
      <tbody v-for="(item,index) in processList" :key=index>
        <tr>
          <td rowspan="2" width="25%">{{item.name}}</td>
          <td width="25%">保存</td>
          <td width="25%">
            <p v-if="item.saveTime.length>0" v-for="(e,i) in item.saveTime" :key=i>{{e}}</p>
          </td>
          <td rowspan="2">
            <PrintButton style="display:inline-block" :Url="printUrl[index]" :Project_id="routerId" :stats='item.submitTime.length>0||item.saveTime.length>0?false:true'></PrintButton>
            <ButtonShow viewOnly='1' style="display:inline-block" :rName="jumpRouterName[index]" :Project_id="routerId" :stats='item.submitTime.length>0||item.saveTime.length>0?false:true'></ButtonShow>
          </td>
        </tr>
        <tr>
          <td>提交</td>
          <td>
            <p v-if="item.submitTime.length>0" v-for="(e,i) in item.submitTime" :key=i>{{e}}</p>
          </td>
        </tr>
      </tbody>
    </table>
  </card>
</template>

<script>
import { getTypeInfo } from '../../libs/status'
export default {
  props: {
    routerId:{
      default: ''
    },
    titleShow: {
      default: true
    },
    inProject:''
  },
  data() {
    return {
      //流程单
      processList: [],  
      jumpRouterName:[
        'createProgram','dataCollection','reconnaissanceTrip','environmentQuality','reportReview',
        'reportTria','technologyAssessment','reportApproval','reportPublicity','reportArchives'
      ],
      // 打印功能
      printUrl: [
        'print/printProject','print/printCollect','print/printSurver','print/printMonitor','print/printFormation','print/printAudit','print/printAppraise','print/printBatch','print/printPublicShow','print/printArchives',
      ],
      // routerId: '',
      loading: true,
    }
  },
  mounted() {
    if(this.routerId) {
      this.loading = false
      this.getProcessList(this.routerId)
    }
  },
  methods: {
    // 项目流程单
    getProcessList(ProjectId) {
      axios.post('/audit/findSubmitTime',{ProjectId:ProjectId}).then(res=>{
        console.log(res)
        if(res._STATUS == 1) {
        this.processList = res.data
        }
      }).catch(err=>{
        console.log(err)
      }) 
    },
  },
}
</script>

<style lang="css">
</style>
